<template>
  <view class="container">
    <view class="top">
      <image class="img" src="../../assets/images/index/sign_success.png"></image>
      <view class="info">
        <view class="title">签单成功</view>
        <view class="text">运单已签收，签收人【{{ info.wxCustomerName }}】</view>
      </view>
    </view>
    <view class="main">
      <view class="head">
        <text>承运单号：{{ order.orderList.billNo }}</text>
        <view class="copy">复制</view>
        <image class="car" src="../../assets/images/orderTracking/bgCar.png"></image>
      </view>
      <view class="sends">
        <view class="row">
          <view class="title_1">发</view>
          <view class="value" style="border-bottom: 1rpx solid #f5f5f5">
            <view class="name">{{ info.shipper }} {{ info.shipperMobile }}</view>
            <view class="pos">{{ info.toFromAdd }}</view>
          </view>
        </view>
        <view class="row">
          <view class="title_2">收</view>
          <view class="value">
            <view class="name">{{ info.receiver }} {{ info.receiverMobile }}</view>
            <view class="pos">{{ info.fromAdd }}</view>
          </view>
        </view>
      </view>
      <view class="sign">
        <view class="row">
          <view class="label">签收人：</view>
          <view class="value">
            <text>{{ info.wxCustomerName }}</text>
            <view class="btn" @click="showSignInfo({})">详细信息＞</view>
          </view>
        </view>
        <view class="row" style="margin-top: 16rpx">
          <view class="label">签收时间：</view>
          <view class="value"><text>{{ info.upTime }}</text></view>
        </view>
      </view>
    </view>
    <view class="bottom_btns">
      <view class="left_btn" @click="toOrder">查看运单</view>
      <view class="right_btn" @click="toSendGoods">再来一单</view>
    </view>
    <drawer :show="showSign" :title="'签收人详细信息'" @close="closeSignInfo" :show-close="true">
      <view class="sign_row" style="margin-top: 24rpx">
        <view class="label">签收人</view>
        <view class="value">{{ info.wxCustomerName }}</view>
      </view>
      <view class="sign_row">
        <view class="label">联系方式</view>
        <view class="value">{{ info.wxPhone }}</view>
      </view>
      <view class="sign_row">
        <view class="label">身份证号</view>
        <view class="value">{{ info.wxCustomerCode }}</view>
      </view>
      <view class="sign_row">
        <view class="label">电子签名</view>
        <view class="value">
          <image class="img" :src="'//'+info.signPic"></image>
        </view>
      </view>
    </drawer>
  </view>
</template>
<script lang="ts" setup>
import Taro, { useDidShow } from "@tarojs/taro";
import { ref } from "vue";
import {$post} from '@/@api'
import useMyOrderStore from "@/store/myOrder";
const order = useMyOrderStore();
const showSign = ref<boolean>(false)
const info = ref<any>({})

const getInfo = async()=>{
  let res: any = await $post(
      "/selfmachine-system/order/list",
      {
        billNo: order.orderList.billNo,
        pickRecord: true
      }
  )
  info.value = res.data.rows[0]
}

const toOrder = () => {
  Taro.navigateTo({
    url: '/pages/myOrder/order',
  })
}
const toSendGoods = () => {
  Taro.navigateTo({
    url: "/pages/sendGoods/index",
  });
}

const showSignInfo = (item)=>{
  showSign.value = true
}
const closeSignInfo = ()=>{
  showSign.value = false
}

getInfo()
</script>
<style lang="scss">
page {
  background-color: #f5f5f5;
}
.container {
  width: 100%;
  box-sizing: border-box;
  padding: 0 24rpx;
  .top {
    width: 100%;
    height: 148rpx;
    border-radius: 16rpx;
    background-color: #fff;
    margin-top: 16rpx;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: 0 40rpx;
    .img {
      width: 68rpx;
      height: 68rpx;
    }
    .info {
      display: flex;
      justify-content: center;
      width: calc(100% - 98rpx);
      flex-direction: column;
      margin-left: 30rpx;
      .title {
        font-size: 32rpx;
        color: #07c160;
        line-height: 48rpx;
        width: 100%;
      }
      .text {
        font-size: 22rpx;
        line-height: 28rpx;
        margin-top: 8rpx;
        color: #252525;
        width: 100%;
      }
    }
  }
  .main {
    width: 100%;
    box-sizing: border-box;
    border-radius: 16rpx;
    margin-top: 16rpx;
    overflow: hidden;
    background-color: #fff;
    padding-bottom: 32rpx;
    .head {
      width: 100%;
      height: 72rpx;
      box-sizing: border-box;
      padding: 0 24rpx;
      display: flex;
      position: relative;
      align-items: center;
      background: linear-gradient(96deg, #CCE0FF 0%, #FFFFFF 100%);
      text {
        font-size: 24rpx;
      }
      .copy {
        font-size: 18rpx;
        padding: 7rpx 12rpx;
        border-radius: 20rpx;
        border: 1rpx solid #666;
        margin-left: 12rpx;
        box-sizing: border-box;
      }
      .car {
        position: absolute;
        right: 0;
        bottom: 0;
        width: 158rpx;
        height: 88rpx;
      }
    }
    .sends {
      width: 100%;
      .row {
        width: 100%;
        display: flex;
        align-items: center;
        font-weight: 500;
        box-sizing: border-box;
        padding: 0 24rpx 0 27rpx;
        .title_1 {
          width: 42rpx;
          height: 42rpx;
          line-height: 42rpx;
          text-align: center;
          background: linear-gradient(150deg, #3783FF 14%, #125AD2 93%);
          color: #fff;
          font-size: 20rpx;
          border-radius: 50%;
        }
        .title_2 {
          width: 42rpx;
          height: 42rpx;
          line-height: 42rpx;
          text-align: center;
          background: linear-gradient(137deg, #13E879 14%, #0EC365 89%);
          color: #fff;
          font-size: 20rpx;
          border-radius: 50%;
        }
        .value {
          width: calc(100% - 60rpx);
          margin-left: 16rpx;
          display: flex;
          flex-direction: column;
          padding: 12rpx 0;
          .name {
            width: 100%;
            font-size: 32rpx;
            line-height: 48rpx;
            color: #252525;
          }
          .pos {
            width: 100%;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
            color: #666;
            font-size: 24rpx;
            line-height: 32rpx;
          }
        }
      }
    }
    .sign {
      width: calc(100% - 48rpx);
      margin-left: 24rpx;
      box-sizing: border-box;
      padding: 32rpx 24rpx;
      border-radius: 8rpx;
      margin-top: 24rpx;
      background-color: #f5f5f5;
      .row {
        width: 100%;
        display: flex;
        align-items: center;
        font-size: 22rpx;
        line-height: 28rpx;
        .label {
          width: 110rpx;
          text-align: right;
        }
        .value {
          display: flex;
          align-items: center;
          .btn {
            color: #0966ff;
            margin-left: 32rpx;
          }
        }
      }
    }
  }
}

.bottom_btns {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 128rpx;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  padding: 20rpx 24rpx;
  .left_btn {
    width: 340rpx;
    box-sizing: border-box;
    height: 100%;
    border-radius: 40rpx;
    color: #252525;
    background-color: #fff;
    line-height: 80rpx;
    font-size: 32rpx;
    text-align: center;
    border: 1rpx solid #c4c4c4;
  }
  .right_btn {
    width: 340rpx;
    box-sizing: border-box;
    height: 100%;
    border-radius: 40rpx;
    color: #fff;
    background-color: #0966ff;
    line-height: 80rpx;
    font-size: 32rpx;
    text-align: center;
  }
}
.sign_row {
  width: 100%;
  box-sizing: border-box;
  padding: 0 24rpx 32rpx;
  display: flex;
  .label {
    width: 152rpx;
    color: #999;
    font-size: 26rpx;
  }
  .value {
    color: #0966ff;
    font-size: 26rpx;
    .img {
      width: 280rpx;
      height: 116rpx;
      border-radius: 8rpx;
      border: 1rpx dashed #c4c4c4;
    }
  }
}
</style>
